<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<link rel="stylesheet" href="css/lib/bootstrap.min.css"/>
		<script src="js/lib/jquery-1.11.0.js"></script>
		<script src="js/lib/bootstrap.min.js"></script>
		<script src="js/lib/angular.min.js"></script>
		<script src="js/base.js" type="text/javascript" charset="utf-8"></script>
	</head>
	 <style>
	 	body{
			font-size:12px;
		}
	 	table,
		/* th,
			td {
				border: 1px solid grey;
				border-collapse: collapse;
				padding: 5px;
				vertical-align: middle !important;
			}	 */	
		table td:nth-child(even) {
			
		}
		table tr:nth-child(2) {
			background-color:#f1f1f1;
		}
		input{
			width:280px;
		}
		span{
			width:20px;color:red;display:inline-block;text-align:center;
		}
		#sho{
			width:300px;
			height:50px;
			background:#d9534f;
			opacity:0.8;
			border-radius:8px;
			color:#fff;
			text-align: center;
			font-size:30px;
			position: absolute;
			top:0px;
			left:550px;
			display:none;
		}
	 </style>
	<body ng-app="myApp" ng-controller="customersCtrl">
		<div class="">
			<div id="sho"></div>
		<!--用户积分流水（详细）-->
			<div style="padding:15px 5px 0px 5px;border:3px solid #ccc;margin-bottom:15px">
			<table class="table table-hover">
				
				<tbody>
					<tr>
						<th colspan="12" style="font-size:26px;color:#337ab7">用户积分流水（详细）：</th>
					</tr>
					
					<tr class="text-center" style="font-size:15px";>
						<td >序号</td>
						<td >订单编号</td>
						<td >品牌</td>
						<td >用户手机</td>
						<td >状态</td>	
						<td >积分</td>						
						<td >备注</td>	
						<td >日期</td>
					</tr>
					<tr class="text-center" id="show" ng-repeat="item in lists">
						<td >{{$index+1}}</td>
						<td >{{item.ordercode}}</td>
						<td >{{item.brand_name}}</td>
						<td >{{item.userphone}}</td>						
						<td style="color:#00EE00">{{item.type | modify0:item.type}}</td>
						<td >{{item.coin}}</td>
						<td >{{item.remark}}</td>
												
						<td >{{item.createTime}}</td>
					</tr>
					<tr>
						<td colspan="12" id="show01" class="text-center">
							第<input class="form-control" id="ye" ng-init="ye=1" ng-model="ye" style="width:50px;display:inline-block" type="text"/>页
							<button class="btn btn-default" ng-click="xia()">跳转</button>总共{{pageas}}条数据    当前一共{{pagea}}页
							<button class="btn btn-default" ng-click="home()">首页</button>
							<button class="btn btn-default" ng-click="sh()">上一页</button>
							<button class="btn btn-default" ng-click="next()">下一页</button>
							<button class="btn btn-default" ng-click="last(page)">尾页</button>
						</td>
					</tr>
				</tbody>
			</table>		
		</div>
		
			
		</div>
	</body>
	
	<script>
		var app = angular.module('myApp', []);
		app.filter("modify0",function(){
			return function(input,param){
				if(param == 0){
					return param = "+"
				}
				if(param == 1){
					return param = "-"
				}
				
				input = param
				return input
			}
		})
	   /*自定义过滤器   1*/
		app.filter("modify",function(){
			return function(input,param){
				if(param == 0){
					return param = "充值"
				}
				if(param == 1){
					return param = "支付"
				}
				if(param == 2){
					return param = "提现"
				}
				if(param == 3){
					return param = "退单"
				}
				input = param
				return input
			}
		})
		/*自定义过滤器   2*/
		app.filter("modify2",function(){
			return function(input,param){
				if(param == 0){
					return param = "待完成"
				}
				if(param == 1){
					return param = "成功"
				}
				if(param == 2){
					return param = "取消"
				}
				input = param
				return input
			}
		})
        app.controller('customersCtrl', function($scope, $http ){
        	/*根据登陆信息获取token*/
        	var token = sessionStorage.getItem(key=1)
        	console.log(token)
			/*获取用户交积分流水（详细）*/
				$http({
					method: 'POST',
					params:{size:10,page:0},
					url: window.baseUrl+"transactionclear/coin/query/"+token,
				}).then(function successCallback(data){
					console.log("请求用户交积分流水（详细）成功...")
					console.log(data.data)
					$scope.lists = data.data.result.content
					$scope.pageas = data.data.result.totalElements
					$scope.pagea  = data.data.result.totalPages
				}, function errorCallback(data){
						console.log("请求用户交积分流水（详细）失败...")
				     	console.log(data)
				})	
			
			$scope.xia = function(){
				var ye = document.getElementById('ye').value-1;
				$http({
					method: 'POST',
					params:{size:10,page:ye},
					url: window.baseUrl+"transactionclear/coin/query/"+token,
				}).then(function successCallback(data){
					console.log("请求用户交积分流水（详细）成功...")
					console.log(data.data)
					$scope.lists = data.data.result.content
					$scope.pageas = data.data.result.totalElements
					$scope.pagea  = data.data.result.totalPages
				}, function errorCallback(data){
						console.log("请求用户交积分流水（详细）失败...")
				     	console.log(data)
				})	
			}

			/*回到首页*/
				$scope.home = function(){
					$scope.ye = 1;
                    $http({
                        method:'POST',
                        params:{size:10,page:$scope.ye-1},
                        url: window.baseUrl+"transactionclear/coin/query/"+token,
                    }).then(function successCallback(data){
                        console.log("直接或分页查询交易明细成功...")
                        console.log(data.data)
                        $scope.lists = data.data.result.content
                        $scope.pages = data.data.result.totalElements
                        $scope.page  = data.data.result.totalPages
                    }, function errorCallback(data) {
                        console.log("直接或分页查询交易明细失败...")
                        console.log(data)
                    });
				}
				/*到达最后一页*/
				$scope.last = function(page){
				    console.log(page);
                    $http({
                        method:'POST',
                        params:{size:10,page:page-1},
                        url: window.baseUrl+"transactionclear/coin/query/"+token,
                    }).then(function successCallback(data){
                        console.log("直接或分页查询交易明细成功...")
                        console.log(data.data)
                        $scope.lists = data.data.result.content
                        $scope.pages = data.data.result.totalElements
                        $scope.page  = data.data.result.totalPages
                    }, function errorCallback(data) {
                        console.log("直接或分页查询交易明细失败...")
                        console.log(data)
                    });
                    $scope.ye = page
				}
				$scope.next = function(){
				   var ye =  $scope.ye+=1;
				   console.log(ye-1)
                    $http({
                        method:'POST',
                        params:{size:10,page:ye-1},
                        url: window.baseUrl+"transactionclear/coin/query/"+token,
                    }).then(function successCallback(data){
                        console.log("直接或分页查询交易明细成功...")
                        console.log(data.data)
                        $scope.lists = data.data.result.content
                        $scope.pages = data.data.result.totalElements
                        $scope.page  = data.data.result.totalPages
                    }, function errorCallback(data) {
                        console.log("直接或分页查询交易明细失败...")
                        console.log(data)
                    });
				}
				$scope.sh = function(){
				    var ye = $scope.ye-=1;
				    ye = ye-1;
				    console.log(ye);
				    if(ye <= 0){
				        $scope.ye = 1;
				        console.log(ye)
					}
                    $http({
                        method:'POST',
                        params:{size:10,page:ye},
                        url: window.baseUrl+"transactionclear/coin/query/"+token,
                    }).then(function successCallback(data){
                        console.log("直接或分页查询交易明细成功...")
                        console.log(data.data)
                        $scope.lists = data.data.result.content
                        $scope.pages = data.data.result.totalElements
                        $scope.page  = data.data.result.totalPages
                    }, function errorCallback(data) {
                        console.log("直接或分页查询交易明细失败...")
                        console.log(data)
                    });

				}
        })
	</script>
</html>


